package org.jeecg.modules.cosmetic.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.modules.cosmetic.handler.PackageCalculationHandler;
import org.jeecg.modules.cosmetic.model.dto.PackCalculationDTO;
import org.jeecg.modules.cosmetic.model.vo.PackageCalculationVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;



/**
 * <p>
 * 包装计算表 前端控制器
 * </p>
 *
 * @author liqing
 * @since 2023-03-23
 */
@Api(tags = "包装计算")
@RestController
@RequestMapping("/api/calculation")
public class TPackageCalculationController {

    @Resource
    private ISysBaseAPI iSysBaseAPI;

    @Resource
    private PackageCalculationHandler packageCalculationHandler;

    @ApiOperation(value = "包装计算-查询商品类型", notes = "包装计算-查询商品类型")
    @GetMapping(value = "/getDictItems")
    public Result<?> getDictItems(@RequestParam("dictCode") String dictCode) {
        return Result.OK(iSysBaseAPI.getDictItems(dictCode));
    }

    @ApiOperation(value = "包装计算-查询产品类别", notes = "包装计算-查询产品类别")
    @GetMapping(value = "/queryPackageType")
    public Result<?> queryPackageType() {
        return Result.OK(packageCalculationHandler.queryPackageType());
    }

    @ApiOperation(value = "包装计算-查询产品类别树型结构", notes = "包装计算-查询产品类别树型结构")
    @GetMapping(value = "/queryPackageTypeTree")
    public Result<?> queryPackageTypeTree() {
        return Result.OK(packageCalculationHandler.queryPackageTypeMap());
    }

    @ApiOperation(value = "包装计算-提交计算", notes = "包装计算-提交计算")
    @PostMapping(value = "/submit")
    public Result<?> submitPackCalculation(@RequestBody PackageCalculationVO vo) {
        return packageCalculationHandler.submitPackCalculation(vo, vo.getList());
    }
}
